
package threadlogging.log4j;

import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.Level;
import org.apache.log4j.spi.LoggingEvent;

public class ThreadTraceAppender extends AppenderSkeleton
{
	public ThreadTraceAppender()
	{
		this.setThreshold(Level.ALL);
	}
	
	protected void append(LoggingEvent evt)
	{
		if (ThreadTrace.isEnabled())
		{
			ThreadTrace.add(evt);
		}
	}

	// todo : setter and getter for ThreadTrace buffer size?
	
	public void close()
	{
		// empty
	}

	public boolean requiresLayout()
	{
		return false;
	}

	
}
